/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.workhorse.persistence.db4o;

import java.util.Collection;

import org.workhorse.exec.Execution;
import org.workhorse.graph.node.Node;
import org.workhorse.persistence.BasePersistence;
import org.workhorse.persistence.Persistence;
import org.workhorse.process.Process;

import com.db4o.ObjectServer;
import com.google.inject.Provider;

/**
 * @author Brennan Spies
 *
 * <p>{@link Persistence} implementation using Db4o.</p>
 */
public class Db4oPersistence extends BasePersistence
{
    private final Provider<ObjectServer> objectServerProvider;
    private ObjectServer objectServer;

    /**
     * Creates the Db4o Persistence service.
     * @param objectServerProvider The provider of the {@code ObjectServer}
     */
    public Db4oPersistence(Provider<ObjectServer> objectServerProvider) {
        this.objectServerProvider = objectServerProvider;
    }

    /**
     * Starts the service.
     */
    public void start() {
        objectServer = objectServerProvider.get();
    }

    /**
     *  Shuts the service down.
     */
    public void shutdown() {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    /**
     * Returns all the executions which are paused at a particular
	 * node.
	 * @param process The process instance
	 * @param node The current node for the paused execution
	 * @return The paused executions
     */
    public Collection<Execution> getPausedExecutions(Process process, Node node) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
